package com.sky.task;

import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

@Component
@Slf4j
public class MyTask {

//    @Async
//    @Scheduled(cron = "0/10 * * * * ? ")
    @XxlJob("execute")
    public ReturnT<String> execute(){
        XxlJobHelper.log("XXL-JOB, Hello World.");
        log.info("定时任务执行了: {}", LocalDateTime.now());
        return ReturnT.SUCCESS;
    }
}
